package com.yaoayao.mall.all.controller;

import com.yaoayao.mall.common.result.Result;
import com.yaoayao.mall.item.client.ItemFeignClient;
import com.yaoayao.mall.product.client.ProductFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;
import org.thymeleaf.context.Context;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author: peiyao
 * @date: 2024/4/14 3:12
 * @description:
 */
@Controller
public class ItemController {

    @Autowired
    private ItemFeignClient itemFeignClient;

    //商品详情页面渲染开始了   https://item.jd.com/100014348492.html
    @GetMapping("/{skuId}.html")
    public String itemPage(@PathVariable Long skuId, Map map) {
        Map<String, Object> result = itemFeignClient.getItem(skuId);
        map.putAll(result);
        return "item/index";
    }
}
